home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / WE-BREAK.ZIP / P4_MAIN.INC < prev    next >
Encoding:
Text File  |  1997-02-28  |  38.6 KB  |  1,205 lines

  1.  
  2. //------------------------------------------------------------------->
  3. //------------------------------------------------------------------->
  4. //
  5. // "p4_main.inc" - Create one object called "One_Person".
  6. //
  7. // "Paul's Primitive POV People", or "P4".
  8. //
  9. // Created by: Paul T. Dawson
  10. //             ptdawson@voicenet.com
  11. //             http://www.voicenet.com/~ptdawson
  12. //
  13. // Version 0.3 - February 28, 1997
  14. //
  15. // Note: You MUST include a "P4DEF_??.INC" file before this file,
  16. //       to set all of the variables for one "person". That DEF file
  17. //       will automatically call this file.
  18. //
  19. // Note: The person is facing you.
  20. //       "Left" is on the left side of your screen.
  21. //       "Right" is on the right side of your screen.
  22. //
  23. // Note: This file is *VERY* jumbled. It works, but it's part of a
  24. //       last minute rush for the IRTC. Good luck figuring it out!
  25. //
  26. // Note: Your main program must include these POV3 files:
  27. //       "colors.inc" "textures.inc" "golds.inc" "stones.inc"
  28. //
  29. // Note: Please send me any improvements and/or changes that you make
  30. //       to this file, and I'll put them into the [frequent?] updates.
  31.  
  32. //------------------------------------------------------------------->
  33. //------------------------------------------------------------------->
  34. //
  35. // There is no shirt type #1. For now, everyone gets shirt type #2.
  36.  
  37.  
  38. //------------------------------------------------------------------->
  39. //------------------------------------------------------------------->
  40. //
  41. // Make the pieces of the uni-gender <G> shirt.
  42.  
  43.         #declare P4_Arm_Height = P4_Shirt_Height - 3
  44.  
  45.         #if ( P4_Shirt_Type = 2 )
  46.  
  47.         #declare Shirt_Body = union {
  48.  
  49.                 // Most of the shirt.
  50.                 cone { <0,0,0>,    14    <0,P4_Arm_Height, 0>,8
  51.                 scale < 0.8, 1, 0.5 > }
  52.  
  53.                 // Round off the top of the cone.
  54.                 sphere{ 0, 8 scale < 1, 0.5, 0.5 >
  55.                         translate y * P4_Arm_Height }
  56.  
  57.                 // Top side-to-side tube.
  58.                 cylinder { <-8,P4_Arm_Height,0><8,P4_Arm_Height,0>,3 }
  59.  
  60.                 // Round off attachments to sleeves.
  61.                 sphere { < -8,P4_Arm_Height,0>,3 }
  62.                 sphere { <  8,P4_Arm_Height,0>,3 }
  63.  
  64.                 } // End of union.
  65.         #end
  66.  
  67. //------------------------------------------------------------------->
  68. //------------------------------------------------------------------->
  69. //
  70. // Make the sleeves, at the correct angles.
  71.  
  72.         #declare Left_Sleeve = cylinder {<0,0,0><-6,0,0>,3
  73.                 rotate P4_Left_Shoulder_Rotate
  74.                 translate < -8, P4_Arm_Height, 0 >
  75.                 } // End of cylinder.
  76.  
  77.         #declare Right_Sleeve = cylinder {<0,0,0><6,0,0>,3
  78.                 rotate P4_Right_Shoulder_Rotate
  79.                 translate < 8, P4_Arm_Height, 0 >
  80.                 } // End of cylinder.
  81.  
  82. //------------------------------------------------------------------->
  83. //------------------------------------------------------------------->
  84. //
  85. // Now put the shirt together.
  86.  
  87.         #declare Shirt = union {
  88.                 object { Shirt_Body }
  89.                 object { Left_Sleeve }
  90.                 object { Right_Sleeve }
  91.  
  92.                 texture { P4_Shirt_Texture }
  93.  
  94.                 } // End of union.
  95.  
  96. //------------------------------------------------------------------->
  97. //------------------------------------------------------------------->
  98. //
  99. // Make the hands (add to forearms in next section). The left hand points
  100. // to the left of your screen (negative x). Right hand points to right.
  101. // Then they get rotated according to the hand rotation variables.
  102.  
  103. // Type #1 is a "fist".
  104.  
  105.         #if ( P4_Hand_Type = 1 )
  106.                 
  107.                 #declare P4_Left_Hand = sphere { 0, 3 scale < 0.6, 1, 1 > }
  108.                 #declare P4_Right_Hand = sphere { 0, 3 scale < 0.6, 1, 1 > }
  109.                 
  110.         #end
  111.  
  112. // Type #2 has fingers pointing straight out.
  113.  
  114.         #if ( P4_Hand_Type = 2 )
  115.  
  116.                 #declare P4_Left_Hand = union {
  117.                         sphere{0,2.5 scale <1,0.5,1> }
  118.  
  119.                         #declare P4_TEMP = -2
  120.                         #while(P4_TEMP<=2)
  121.  
  122.                                 #declare TEMP2=-7
  123.                                 #if(P4_TEMP=-2)#declare TEMP2=-5 #end
  124.                                 
  125.                                 cone{<0,0,0>, 0.75 <TEMP2,0,0>, 0.25
  126.                                 rotate y * (P4_TEMP*20) }
  127.  
  128.                         #declare P4_TEMP = P4_TEMP + 1
  129.                         #end
  130.  
  131.                         } // End of union.
  132.  
  133.                 #declare P4_Right_Hand = union {
  134.                         sphere{0,2.5 scale <1,0.5,1> }
  135.  
  136.                         #declare P4_TEMP = -2
  137.                         #while(P4_TEMP<=2)
  138.                                 
  139.                                 #declare TEMP2=7
  140.                                 #if(P4_TEMP=2)#declare TEMP2=5 #end
  141.  
  142.                                 cone{<0,0,0>, 0.75 <TEMP2,0,0>, 0.25
  143.                                 rotate y * (P4_TEMP*20) }
  144.  
  145.                         #declare P4_TEMP = P4_TEMP + 1
  146.                         #end
  147.  
  148.                         } // End of union.
  149.  
  150.         #end
  151.  
  152. // If a "holding" object was defined, put it in LEFT hand right now.
  153.  
  154.         #if ( P4_Holding_Flag = true )
  155.  
  156.                 #declare P4_Temp_Left_Hand = union {
  157.  
  158.                         object { P4_Left_Hand }
  159.                         object { P4_Holding_Object }
  160.  
  161.                         } // End of union.
  162.  
  163.                 #declare P4_Left_Hand = object { P4_Temp_Left_Hand }
  164.  
  165.         #end
  166.  
  167. //------------------------------------------------------------------->
  168. //------------------------------------------------------------------->
  169. //
  170. // Add some arms.
  171.  
  172.         // The left arm *might* get a bracelet!
  173.  
  174.         #declare Left_Fore_Arm = union {
  175.  
  176.                 object { P4_Left_Hand
  177.                         rotate P4_Left_Hand_Rotate
  178.                         translate x*-14 }
  179.                 cylinder { < 0, 0, 0 > < -14, 0, 0 >, 2 }
  180.                 sphere { 0, 2 }
  181.  
  182.                 #if ( P4_Bracelet_Flag = true )
  183.                         object { P4_Bracelet_Object
  184.                                 rotate z * 90
  185.                                 translate x * -9 }
  186.                 #end
  187.  
  188.                 rotate P4_Left_Elbow_Rotate
  189.  
  190.                 } // End of cylinder.
  191.  
  192.         #declare Right_Fore_Arm = union {
  193.  
  194.                 object { P4_Right_Hand
  195.                         rotate P4_Right_Hand_Rotate
  196.                         translate x*14 }
  197.                 cylinder { < 0, 0, 0 > < 14, 0, 0 >, 2 }
  198.                 sphere { 0, 2 }
  199.  
  200.                 rotate P4_Right_Elbow_Rotate
  201.  
  202.                 } // End of cylinder.
  203.  
  204.  
  205.         #declare Left_Arm = union {
  206.                 cylinder {<0,0,0><-14,0,0>,2  }
  207.                 object{Left_Fore_Arm translate x*-14}
  208.  
  209.                 rotate P4_Left_Shoulder_Rotate
  210.                 translate < -8, P4_Arm_Height, 0 >
  211.  
  212.                 texture { P4_Skin_Texture }
  213.  
  214.                 } // End of union.
  215.  
  216.         #declare Right_Arm = union {
  217.                 cylinder {<0,0,0><14,0,0>,2 }
  218.                 object{Right_Fore_Arm translate x*14}
  219.  
  220.                 rotate P4_Right_Shoulder_Rotate
  221.                 translate < 8, P4_Arm_Height, 0 >
  222.  
  223.                 texture { P4_Skin_Texture }
  224.  
  225.                 } // End of cylinder.
  226.  
  227. //------------------------------------------------------------------->
  228. //------------------------------------------------------------------->
  229. //
  230. // Build the parts for the head. It starts on the floor (y=0).
  231.  
  232.         // Make neck a little higher than necessary, to fill in
  233.         // the gap where chin is differenced from head.
  234.  
  235.         #declare Neck= union {
  236.  
  237.                 cone { <0,0,0>,3 <0, P4_Neck_Height+3, 0>,1.7 }
  238.                 sphere { <0,0,0>,3 }
  239.  
  240.                 texture { P4_Skin_Texture }
  241.  
  242.                 } // End of union.
  243.  
  244. //------------------------------------------------------------------->
  245. //------------------------------------------------------------------->
  246. //
  247. // Put the head together. It's just one big sphere, with a lot of
  248. // little pieces differenced from it.
  249.  
  250.         #declare Head = difference {
  251.  
  252.                 sphere{0,5 scale <1,1.5,1> }
  253.  
  254.                 // Left eye cutout.
  255.                 cone { <0,0,0>, 1.6 <0,0,-11>, 3.6
  256.                         scale < 1.2, 0.7, 1 >
  257.                         translate < -1.7, 1, -3.8 > }
  258.  
  259.                 // Right eye cutout.
  260.                 cone { <0,0,0>, 1.6 <0,0,-11>, 3.6
  261.                         scale < 1.2, 0.7, 1 >
  262.                         translate <  1.7, 1, -3.8 > }
  263.  
  264.                 // Chin. This box is angled downwards (so-so).
  265.                         box { < -9, -9, -9 > < 9, 0, 0 >
  266.                                 rotate x * 15
  267.                                 translate y * -6.15 }
  268.  
  269.                 // Diagonal cutout around mouth/cheeks.
  270.                 box{ < -3.0, -3.0, -10 > < 3.0, 3.0, -3.8 >
  271.                         rotate z*45
  272.                         scale < 1, 1.2, 1 >
  273.                         translate y * -4 }
  274.  
  275.                 // Slice off a tiny bit of rounded front surface.
  276.                 box{ < -9, -9, -9 > < 9, 1.4, -3.85 > }
  277.  
  278.                 texture { P4_Skin_Texture }
  279.  
  280.         } // End of difference.
  281.  
  282. //------------------------------------------------------------------->
  283. //------------------------------------------------------------------->
  284. //
  285. // Make some noses.
  286.  
  287. // Regular size nose.
  288.  
  289.         #if ( P4_Nose_Type = 1 )
  290.  
  291.                 #declare P4_Nose = difference {
  292.  
  293.                         sphere { 0, 2.8 scale < 0.25, 1, 0.25 > }
  294.  
  295.                         box { < -5, -5, -5 > < 5, 0, 5 > }
  296.  
  297.                         translate <0, (3+P4_Neck_Height), -3.8>
  298.  
  299.                         texture { P4_Skin_Texture }
  300.  
  301.                         } // End of difference.
  302.  
  303.         #end
  304.  
  305. // Slightly larger nose.
  306.  
  307.         #if ( P4_Nose_Type = 2 )
  308.  
  309.                 #declare P4_Nose = difference {
  310.  
  311.                         sphere { 0, 2.8 scale < 0.35, 1, 0.35 > }
  312.  
  313.                         box { < -5, -5, -5 > < 5, 0, 5 > }
  314.  
  315.                         translate <0, (3+P4_Neck_Height), -3.8>
  316.  
  317.                         texture { P4_Skin_Texture }
  318.  
  319.                         } // End of difference.
  320.  
  321.         #end
  322.  
  323. //------------------------------------------------------------------->
  324. //------------------------------------------------------------------->
  325. //
  326. // Now make some ears.
  327.  
  328.         #declare P4_Left_Ear = union {
  329.  
  330.                 sphere { 0, 1.5 scale < 1, 0.1, 1 > }
  331.  
  332.                 torus { 1.3, 0.3 }
  333.  
  334.                 rotate x * 90
  335.                 rotate y * 30
  336.  
  337.                 translate x * -5
  338.  
  339.                 texture { P4_Skin_Texture }
  340.  
  341.         } // End of union.
  342.  
  343.         #declare P4_Right_Ear = union {
  344.  
  345.                 sphere { 0, 1.5 scale < 1, 0.1, 1 > }
  346.  
  347.                 torus { 1.3, 0.3 }
  348.  
  349.                 rotate x * 90
  350.                 rotate y * -30
  351.  
  352.                 translate x * 5
  353.  
  354.                 texture { P4_Skin_Texture }
  355.  
  356.         } // End of union.
  357.  
  358. //------------------------------------------------------------------->
  359. //------------------------------------------------------------------->
  360. //
  361. // The eyes are not realistic, but they sure are *complicated* !!!
  362.  
  363.         #declare Two_Eyes = union {
  364.  
  365.                 // White part.
  366.                 sphere{0,1  scale < 1, 0.6, 0.2 >
  367.                 pigment{White} translate x*-2}
  368.  
  369.                 sphere{0,1  scale < 1, 0.6, 0.2 >
  370.                 pigment{White} translate x* 2}
  371.  
  372.                 // Color part.
  373.                 sphere{0,0.4 scale < 1, 1, 0.3 >
  374.                 texture{P4_Eye_Texture} translate <-2,0,-0.1>}
  375.  
  376.                 sphere{0,0.4 scale < 1, 1, 0.3 >
  377.                 texture{P4_Eye_Texture} translate < 2,0,-0.1>}
  378.  
  379.                 // Black part.
  380.                 sphere{0,0.2 scale <1,1,0.7>
  381.                 pigment{Gray10} translate <-2,0, -0.1>}
  382.  
  383.                 sphere{0,0.2 scale <1,1,0.7>
  384.                 pigment{Gray10} translate < 2,0, -0.1>}
  385.  
  386.                 // Left eyelid.
  387.                 difference {
  388.                         sphere{ 0, 1.3 }
  389.                         box { <-2,-2,-2> <2,2,0> }
  390.                         texture { P4_Skin_Texture }
  391.                         rotate x * P4_Left_Eyelid_Rotate
  392.                         scale < 1, 0.6, 0.2 >
  393.                         translate x * -2
  394.                 } // End of difference.
  395.  
  396.                 // Right eyelid.
  397.                 difference {
  398.                         sphere { 0,1.3 }
  399.                         box { <-2,-2,-2> <2,2,0> }
  400.                         texture { P4_Skin_Texture }
  401.                         rotate x * P4_Right_Eyelid_Rotate
  402.                         scale < 1, 0.6, 0.2 >
  403.                         translate x * 2
  404.                 } // End of difference.
  405.  
  406.                 // Cover bottom of left eye.
  407.                 difference {
  408.                         sphere{ 0, 1.3 }
  409.                         box { <-2,-2,-2> <2,2,0> }
  410.                         texture { P4_Skin_Texture }
  411.                         rotate x * 30
  412.                         scale < 1, 0.6, 0.2 >
  413.                         translate x * -2
  414.                 } // End of difference.
  415.  
  416.                 // Cover bottom of right eye.
  417.                 difference {
  418.                         sphere{ 0, 1.3 }
  419.                         box { <-2,-2,-2> <2,2,0> }
  420.                         texture { P4_Skin_Texture }
  421.                         rotate x * 30
  422.                         scale < 1, 0.6, 0.2 >
  423.                         translate x * 2
  424.                 } // End of difference.
  425.  
  426.                 } // End of union.
  427.  
  428. //------------------------------------------------------------------->
  429. //------------------------------------------------------------------->
  430. //
  431. // Maybe make some glasses.
  432.  
  433.         #if ( P4_Glasses_Type = 1 )
  434.  
  435.                 #declare P4_Glasses = union {
  436.  
  437.                         // Glass.
  438.                         sphere { 0, 2 scale < 1, 0.7, 0.01 >
  439.                                 texture { P4_Glasses_Texture }
  440.                                 translate x * -2.2 }
  441.  
  442.                         sphere { 0, 2 scale < 1, 0.7, 0.01 >
  443.                                 texture { P4_Glasses_Texture }
  444.                                 translate x * 2.2 }
  445.  
  446.                         // Rims.
  447.                         torus { 2, 0.1 rotate x * 90
  448.                                 scale < 1, 0.7, 1 >
  449.                                 pigment { SteelBlue }
  450.                                 translate x * -2.2 }
  451.  
  452.                         torus { 2, 0.1 rotate x * 90
  453.                                 scale < 1, 0.7, 1 >
  454.                                 pigment { SteelBlue }
  455.                                 translate x * 2.2 }
  456.  
  457.                         // Center connector.
  458.                         cylinder { < -0.2, 0, 0 > < 0.2, 0, 0 >, 0.1
  459.                                 pigment { SteelBlue } }
  460.  
  461.                         // Back to ears.
  462.                         cylinder { < -4.2, 0, 0 > < -5.4, 0, 4.6 >, 0.1
  463.                                 pigment { SteelBlue } }
  464.  
  465.                         cylinder { < 4.2, 0, 0 > < 5.4, 0, 4.6 >, 0.1
  466.                                 pigment { SteelBlue } }
  467.  
  468.                 } // End of union.
  469.  
  470.         #end
  471.  
  472. //------------------------------------------------------------------->
  473. //------------------------------------------------------------------->
  474. //
  475. // Choose a mouth type. These are all very NON-artistic, sorry!
  476.  
  477. //------------------------------------------------------------------->
  478. //------------------------------------------------------------------->
  479. //
  480. // Straight across mouth.
  481.  
  482.         #if (P4_Mouth_Type=1)
  483.         #declare P4_Mouth = union {
  484.  
  485.                 sphere{0,2 scale<1,0.2,0.2> translate <0, 0.1,0>}
  486.                 sphere{0,2 scale<1,0.2,0.2> translate <0,-0.1,0>}
  487.  
  488.                 texture { P4_Lip_Texture }
  489.  
  490.                 } // End of union.
  491.         #end
  492.  
  493. //------------------------------------------------------------------->
  494. //------------------------------------------------------------------->
  495. //
  496. // Sort-of-smiling-mouth.
  497.  
  498.         #if (P4_Mouth_Type=2)
  499.         #declare P4_Mouth = union {
  500.                 torus{1.5,0.2 texture { P4_Lip_Texture } }
  501.                 sphere{0,1.6 scale<1,0.1,1>pigment{White}}
  502.  
  503.                 rotate x*-90
  504.                 scale <1,0.5,1>
  505.  
  506.                 } // End of union.
  507.         #end
  508.  
  509. //------------------------------------------------------------------->
  510. //------------------------------------------------------------------->
  511. //
  512. // Slightly different smile.
  513.  
  514.         #if ( P4_Mouth_Type = 3 )
  515.         #declare P4_Mouth = union {
  516.  
  517.                 difference {
  518.  
  519.                         union {
  520.                                 torus{ 2, 0.4 texture { P4_Lip_Texture }}
  521.                                 sphere{0,2 scale<1,0.1,1>pigment{White}}
  522.                                 rotate x*-90
  523.                         } // End of union.
  524.  
  525.                         box{<-5,0,-5><5,5,5> texture { P4_Lip_Texture } }
  526.  
  527.                         } // End of difference.
  528.  
  529.                 cylinder{<-2,0,0><2,0,0>,0.4 texture { P4_Lip_Texture } }
  530.  
  531.                 scale <1,0.5,1>
  532.  
  533.                 translate y * 0.5
  534.  
  535.                 } // End of union.
  536.         #end
  537.  
  538. //------------------------------------------------------------------->
  539. //------------------------------------------------------------------->
  540. //
  541. // Upside-down smile (more of a growl).
  542.  
  543.         #if ( P4_Mouth_Type = 4 )
  544.         #declare P4_Mouth = union {
  545.  
  546.                 difference {
  547.  
  548.                         union {
  549.                                 torus{1.5,0.2 texture { P4_Lip_Texture }}
  550.                                 sphere{0,1.6 scale<1,0.1,1>pigment{White}}
  551.                                 rotate x*-90
  552.                         } // End of union.
  553.  
  554.                         box{<-5,-5,-5><5,0,5> texture { P4_Lip_Texture } }
  555.  
  556.                         } // End of difference.
  557.  
  558.                 cylinder{<-1.5,0,0><1.5,0,0>,0.2 texture { P4_Lip_Texture } }
  559.  
  560.                 scale <1,0.5,1>
  561.  
  562.                 translate y * -0.25
  563.  
  564.                 } // End of union.
  565.         #end
  566.  
  567. //------------------------------------------------------------------->
  568. //------------------------------------------------------------------->
  569. //
  570. // Straight and narrow mouth.
  571.  
  572.         #if ( P4_Mouth_Type = 5 )
  573.         #declare P4_Mouth = union {
  574.  
  575.                 sphere{0,2 scale<0.5,0.2,0.2> translate <0, 0.1,0>}
  576.                 sphere{0,2 scale<0.5,0.2,0.2> translate <0,-0.1,0>}
  577.  
  578.                 texture { P4_Lip_Texture }
  579.  
  580.                 } // End of union.
  581.         #end
  582.  
  583. //------------------------------------------------------------------->
  584. //------------------------------------------------------------------->
  585. //
  586. // Choose one of the hair styles.
  587.  
  588. //------------------------------------------------------------------->
  589. //------------------------------------------------------------------->
  590. //
  591. // Very simple, sort of a [sloppy] crew-cut.
  592.  
  593.         #if(P4_Hair_Type=1)
  594.  
  595.                 #declare P4_Hair = difference{
  596.  
  597.                         sphere{0,5.5 scale <1,1.5,1>}
  598.  
  599.                         // Clip around front of face.
  600.                         box { < -10, -20, -10 > < 10, 4, 0 >
  601.                                 rotate x*-10 }
  602.  
  603.                         // Clip along collar line.
  604.                         box { < -10, -20, -10 > < 10, -3, 10 > }
  605.  
  606.                         texture{P4_Hair_Texture}
  607.  
  608.                         } // End of difference.
  609.  
  610.         #end
  611.  
  612. //------------------------------------------------------------------->
  613. //------------------------------------------------------------------->
  614. //
  615. // Wild frizzy mess.
  616.  
  617.         #if ( P4_Hair_Type = 2 )
  618.  
  619.                 #declare P4_Hair = difference{
  620.  
  621.                         // Normal hair to fill in gaps.
  622.                         union {
  623.                         sphere{0,5.5 scale <1,1.5,1>}
  624.  
  625.                         // This is the [memory gobbling] frizzy stuff.
  626.                         #declare A=0 #while(A<100)
  627.                                 sphere{0,14 scale < 0.1, 1, 0.1 >
  628.                                 rotate<rand(P4_RAND)*360,
  629.                                        rand(P4_RAND)*360,
  630.                                        rand(P4_RAND)*360 > }
  631.                         #declare A=A+1 #end
  632.  
  633.                         } // End of union.
  634.  
  635.                         // Clip around front of face.
  636.                         box { < -30, -30, -30 > < 30, 4, 0 >
  637.                                 rotate x*-10 }
  638.  
  639.                         // Clip along collar line.
  640.                         //box { < -10, -20, -10 > < 10, -3, 10 > }
  641.  
  642.                         texture{P4_Hair_Texture}
  643.  
  644.                         } // End of difference.
  645.  
  646.         #end
  647.  
  648. //------------------------------------------------------------------->
  649. //------------------------------------------------------------------->
  650. //
  651. // Long hair.
  652.  
  653.         #if ( P4_Hair_Type = 3 )
  654.  
  655.                 #declare P4_Hair = difference {
  656.  
  657.                         // Normal hair to fill in gaps.
  658.                         union {
  659.                         sphere{0,5.5 scale <1,1.5,1> }
  660.  
  661.                         // This is the long hair.
  662.                         #declare A=0 #while(A<100)
  663.  
  664.                                 torus { 20, 0.3
  665.                                         // Flip it up.
  666.                                         rotate z*90
  667.                                         // Narrow it.
  668.                                         scale < 0.4, 1, 0.4 >
  669.                                         // Spin it around.
  670.                                         rotate y*(rand(P4_RAND)*360)
  671.                                         // Move it down a little.
  672.                                         translate y * -11
  673.                                         } // End of torus.
  674.  
  675.                         #declare A=A+1 #end
  676.  
  677.                         } // End of union.
  678.  
  679.                         // Clip around front of face.
  680.                         box { < -30, -30, -30 > < 30, 3, 0 >
  681.                                 rotate x*-10 }
  682.  
  683.                         // Clip along bottom in back.
  684.                         box { < -10, -40, -10 > < 10, -20, 10 > }
  685.  
  686.                         texture{P4_Hair_Texture}
  687.  
  688.                         } // End of difference.
  689.  
  690.         #end
  691.  
  692. //------------------------------------------------------------------->
  693. //------------------------------------------------------------------->
  694. //
  695. // Now for the hats.
  696.  
  697. //------------------------------------------------------------------->
  698. //------------------------------------------------------------------->
  699. //
  700. // Type 1 is a painters hat.
  701.  
  702.         #if ( P4_Hat_Type = 1 )
  703.  
  704.         #declare Hat = union {
  705.  
  706.                 // Tall part.
  707.                         cylinder { < 0, 0, 0 > < 0, 5, 0 >, 6 }
  708.                 // Square bill.
  709.                         box { < -6, 0, 0 > < 6, 0.5, -8 > }
  710.                 // Rounded front of bill.
  711.                         cylinder { < 0, 0, -8 > < 0, 0.5, -8 >, 6 }
  712.  
  713.                 texture { P4_Hat_Texture }
  714.  
  715.                 } // End of union.
  716.  
  717.         #end
  718.  
  719. //------------------------------------------------------------------->
  720. //------------------------------------------------------------------->
  721. //
  722. // Type 2 is a propellor beanie.
  723.  
  724.         #if ( P4_Hat_Type = 2 )
  725.  
  726.         #declare Hat = union {
  727.  
  728.                 // Beanie part.
  729.                         difference {
  730.                         sphere { 0, 7 scale < 1, 0.8, 1> }
  731.                         box { <-10,-10,-10> <10,0,10> }
  732.                         texture {P4_Hat_Texture}
  733.                         } // End of difference.
  734.                 // Brim.
  735.                         difference {
  736.                         cone { <0,0,  0>,7.5 <0,1.5,0>, 8.5 }
  737.                         cone { <0,0.1,0>,7.4 <0,1.6,0>, 8.4 }
  738.                         texture { P4_Hat_Texture rotate y*90 }
  739.                         } // End of difference.
  740.                 // Propellor.
  741.                         sphere{0,5 scale<1,0.1,0.2>pigment{Red}
  742.                         translate y * 7 }
  743.                 // Connector.
  744.                         cylinder{<0,3,0><0,7,0>,0.5 pigment{Blue}}
  745.                 // Fastener on top of propellor.
  746.                         sphere { 0, 0.5 translate y * 7.5
  747.                                 pigment { Yellow } }
  748.  
  749.                 } // End of union.
  750.  
  751.         #end
  752.  
  753. //------------------------------------------------------------------->
  754. //------------------------------------------------------------------->
  755. //
  756. // Type 3 is a mailman's helmet.
  757.  
  758.         #if ( P4_Hat_Type = 3 )
  759.  
  760.         #declare Hat = union {
  761.  
  762.                 // Beanie part.
  763.                         difference {
  764.                         sphere { 0, 6 scale < 1, 1.2, 1 > }
  765.                         box { <-10,-10,-10> <10,0,10> }
  766.  
  767.                         } // End of difference.
  768.                 // Brim.
  769.                         sphere { 0, 10 scale < 1, 0.1, 1 > }
  770.  
  771.                 texture { P4_Hat_Texture }
  772.  
  773.                 } // End of union.
  774.  
  775.         #end
  776.  
  777. //------------------------------------------------------------------->
  778. //------------------------------------------------------------------->
  779. //
  780. // Type 4 is D. P. Gumby - handkerchief with knotted corners.
  781.  
  782.         #if ( P4_Hat_Type = 4 )
  783.  
  784.         #declare Hat = union {
  785.  
  786.                 // Beanie part.
  787.                 difference {
  788.                         sphere { 0, 7 scale < 1, 0.7, 1 > }
  789.                         box { <-10,-10,-10> <10,0,10> }
  790.                 } // End of difference.
  791.  
  792.                 // Four knots.
  793.                 #declare P4_TEMP = 1
  794.                 #while ( P4_TEMP <= 4 )
  795.  
  796.                         sphere { 0, 1.5 translate x * 6
  797.                                 rotate y * ((P4_TEMP*90)+45)
  798.                                 } // End of sphere.
  799.  
  800.                         cone { <0,0,0>, 1.0 <0,-4,0>, 0.5
  801.                                 rotate z * 30
  802.                                 translate x * 6
  803.                                 rotate y * ((P4_TEMP*90)+45)
  804.                                 } // End of cone.
  805.  
  806.                 #declare P4_TEMP = P4_TEMP + 1
  807.                 #end
  808.  
  809.                 texture { P4_Hat_Texture }
  810.  
  811.                 } // End of union.
  812.  
  813.         #end
  814.  
  815. //------------------------------------------------------------------->
  816. //------------------------------------------------------------------->
  817. //
  818. // Type 5 is a baseball hat.
  819.  
  820.         #if ( P4_Hat_Type = 5 )
  821.  
  822.         #declare Hat = union {
  823.  
  824.                 // Beanie part.
  825.                         difference {
  826.                         sphere { 0, 7 scale < 1, 0.8, 1> }
  827.                         box { <-10,-10,-10> <10,0,10> }
  828.  
  829.                         } // End of difference.
  830.  
  831.                 // Square bill.
  832.                         box { < -7, 0, 0 > < 7, 0.5, -8 > }
  833.                 // Rounded front of bill.
  834.                         cylinder { < 0, 0, -8 > < 0, 0.5, -8 >, 7 }
  835.  
  836.                 texture { P4_Hat_Texture }
  837.  
  838.                 } // End of union.
  839.  
  840.         #end
  841.  
  842. //------------------------------------------------------------------->
  843. //------------------------------------------------------------------->
  844. //
  845. // Assemble head and move to correct height.
  846.  
  847.         #declare Entire_Head = union {
  848.  
  849.                 object { Neck }
  850.                 object { Head translate y* (4.5+P4_Neck_Height) }
  851.  
  852.                 #if ( P4_Hat_Type != 0 )
  853.                         object { Hat
  854.                                 rotate P4_Hat_Rotate
  855.                                 translate y * (9+P4_Neck_Height) }
  856.                 #end
  857.  
  858.                 #if ( P4_Glasses_Type != 0 )
  859.                         object { P4_Glasses
  860.                         translate < 0, (5.5+P4_Neck_Height), -4.6> }
  861.                 #end
  862.  
  863.                 object{Two_Eyes translate <0,(5.5+P4_Neck_Height),-3.8>}
  864.                 object{P4_Mouth translate <0, (1.5+P4_Neck_Height) ,-3.9 > }
  865.  
  866.                 object { P4_Nose }
  867.                 object { P4_Left_Ear  translate y * (5+P4_Neck_Height) }
  868.                 object { P4_Right_Ear translate y * (5+P4_Neck_Height) }
  869.  
  870.                 object{P4_Hair translate y* (4.5+P4_Neck_Height) }
  871.  
  872.                 // Bottom of neck is at <0,0,0>, so rotate it all.
  873.                         rotate P4_Neck_Rotate
  874.  
  875.                 // Now raise to proper height.
  876.                         translate y * P4_Shirt_Height
  877.  
  878.                 } // End of union.
  879.  
  880. //------------------------------------------------------------------->
  881. //------------------------------------------------------------------->
  882. //
  883. // Build some shorts.
  884.  
  885. //------------------------------------------------------------------->
  886. //------------------------------------------------------------------->
  887. //
  888. // Type 1 is baggy.
  889.  
  890.         #if ( P4_Shorts_Type = 1 )
  891.  
  892.         #declare Hollow_Piece = difference {
  893.  
  894.                 cone { <0,0,0>,6      <0, (P4_Shorts_Height*-1), 0>,8 }
  895.                 cone { <0,0.01,0>,5.5 <0, (P4_Shorts_Height*-1)-0.01, 0>,7.5 }
  896.  
  897.                 } // End of difference.
  898.  
  899.         #declare Shorts = union {
  900.  
  901.                 // Eveners.
  902.                 sphere {<-3,0,0>,6  }
  903.                 sphere {< 3,0,0>,6  }
  904.  
  905.                 object { Hollow_Piece
  906.                         rotate P4_Left_Leg_Rotate
  907.                         translate x * -3 }
  908.  
  909.                 object { Hollow_Piece
  910.                         rotate P4_Right_Leg_Rotate
  911.                         translate x * 3 }
  912.  
  913.                 texture{P4_Shorts_Texture}
  914.  
  915.                 } // End of union.
  916.  
  917.         #end
  918.  
  919. //------------------------------------------------------------------->
  920. //------------------------------------------------------------------->
  921. //
  922. // Type 2 is tight.
  923.  
  924.         #if ( P4_Shorts_Type = 2 )
  925.  
  926.         #declare Hollow_Piece =
  927.  
  928.                 cone { <0,0,0>,5.1 <0, (P4_Shorts_Height*-1), 0>,5.0 }
  929.  
  930.         #declare Shorts = union {
  931.  
  932.                 // Eveners.
  933.                 sphere {<-2.1,0,1>,5.5  }
  934.                 sphere {< 2.1,0,1>,5.5  }
  935.  
  936.                 object { Hollow_Piece
  937.                         rotate P4_Left_Leg_Rotate
  938.                         translate x * -3 }
  939.  
  940.                 object { Hollow_Piece
  941.                         rotate P4_Right_Leg_Rotate
  942.                         translate x * 3 }
  943.  
  944.                 texture{P4_Shorts_Texture}
  945.  
  946.                 } // End of union.
  947.  
  948.         #end
  949.  
  950. //------------------------------------------------------------------->
  951. //------------------------------------------------------------------->
  952. //
  953. // Type 3 is medium baggy.
  954.  
  955.         #if ( P4_Shorts_Type = 3 )
  956.  
  957.         #declare Hollow_Piece = difference {
  958.  
  959.                 cone { <0,0,0>,5.5      <0, (P4_Shorts_Height*-1), 0>,6.5 }
  960.                 cone { <0,0.01,0>,5.4 <0, (P4_Shorts_Height*-1)-0.01, 0>,6.4 }
  961.  
  962.                 } // End of difference.
  963.  
  964.         #declare Shorts = union {
  965.  
  966.                 // Eveners.
  967.                 sphere {<-3,0,0>,5.5  }
  968.                 sphere {< 3,0,0>,5.5  }
  969.  
  970.                 object { Hollow_Piece
  971.                         rotate P4_Left_Leg_Rotate
  972.                         translate x * -3 }
  973.  
  974.                 object { Hollow_Piece
  975.                         rotate P4_Right_Leg_Rotate
  976.                         translate x * 3 }
  977.  
  978.                 texture{P4_Shorts_Texture}
  979.  
  980.                 } // End of union.
  981.  
  982.         #end
  983.  
  984. //------------------------------------------------------------------->
  985. //------------------------------------------------------------------->
  986. //
  987. // Now make some shoes.
  988.  
  989. //------------------------------------------------------------------->
  990. //------------------------------------------------------------------->
  991. //
  992. // Build some hi-top sneakers.
  993.  
  994.         #if ( P4_Shoe_Type = 1 )
  995.  
  996.         #declare One_Shoe = union {
  997.  
  998.                 cylinder { < 0, 0, 0 > < 0, -8, 0 >, 3 }
  999.  
  1000.                 cylinder { < 0, -4, 0 > < 0, -8, 0 >, 2.5
  1001.                         scale < 1, 1, 2 >
  1002.                         translate z * -2 }
  1003.  
  1004.                 texture { P4_Shoe_Texture }
  1005.  
  1006.                 } // End of union.
  1007.  
  1008.         #end
  1009.  
  1010. //------------------------------------------------------------------->
  1011. //------------------------------------------------------------------->
  1012. //
  1013. // Build some in-line-skates.
  1014.  
  1015.         #if ( P4_Shoe_Type = 2 )
  1016.  
  1017.         #declare One_Shoe = union {
  1018.  
  1019.                 // Top of boot.
  1020.                 cylinder { < 0, 0, 0 > < 0, -8, 0 >, 3
  1021.                 texture { P4_Shoe_Texture } }
  1022.  
  1023.                 // Bottom of boot - ends up at (z=3 to z=-9).
  1024.                 cylinder { < 0, -4, 0 > < 0, -8, 0 >, 3
  1025.                         scale < 1, 1, 2 >
  1026.                         translate z * -3
  1027.                         texture { P4_Shoe_Texture } }
  1028.  
  1029.                 // Top part - Latch thingies.
  1030.                 sphere{0,3 scale<1,0.2,1>translate <0,-1,-1>pigment{NeonBlue}}
  1031.                 sphere{0,3 scale<1,0.2,1>translate <0,-2,-1>pigment{NeonBlue}}
  1032.                 sphere{0,3 scale<1,0.2,1>translate <0,-3,-1>pigment{NeonBlue}}
  1033.  
  1034.                 // Bottom part - Latch thingies.
  1035.                 sphere{0,2 scale<1,0.5,0.2>translate <0,-4,-5>pigment{NeonBlue}}
  1036.                 sphere{0,2 scale<1,0.5,0.2>translate <0,-4,-6>pigment{NeonBlue}}
  1037.                 sphere{0,2 scale<1,0.5,0.2>translate <0,-4,-7>pigment{NeonBlue}}
  1038.  
  1039.                 // Wheels.
  1040.                 torus{1.0,0.5 pigment{Red} rotate z*90 translate<0,-10,  1>}
  1041.                 torus{1.0,0.5 pigment{Red} rotate z*90 translate<0,-10, -3>}
  1042.                 torus{1.0,0.5 pigment{Red} rotate z*90 translate<0,-10, -7>}
  1043.  
  1044.                 // Vertical holders for the wheels.
  1045.                 box{<-1.0,-5,  1-0.5> <1.0,-10.5,  1+0.5> pigment{SteelBlue} }
  1046.                 box{<-1.0,-5, -3-0.5> <1.0,-10.5, -3+0.5> pigment{SteelBlue} }
  1047.                 box{<-1.0,-5, -7-0.5> <1.0,-10.5, -7+0.5> pigment{SteelBlue} }
  1048.  
  1049.                 // Long connector for all wheels (and brake pad).
  1050.                         box{<-1.0,-9.75, 4.5 > <1.0,-10.25,-7+0.5 >
  1051.                                 pigment { SteelBlue } }
  1052.  
  1053.                 // Brake pad.
  1054.                 union {
  1055.                         box { < -1, -5, -0.5 > < 1, -5.5, 0.5 >
  1056.                                 pigment { Gray20 } }
  1057.  
  1058.                         box { < -1, 0, -0.5 > < 1, -5.0, 0.5 >
  1059.                                 pigment { SteelBlue } }
  1060.  
  1061.                         rotate x * -35
  1062.                         translate < 0, -6, 2 >
  1063.                         } // End of union.
  1064.  
  1065.                 } // End of union.
  1066.  
  1067.         #end
  1068.  
  1069. //------------------------------------------------------------------->
  1070. //------------------------------------------------------------------->
  1071. //
  1072. // Build some lo-top sneakers.
  1073.  
  1074.         #if ( P4_Shoe_Type = 3 )
  1075.  
  1076.         #declare One_Shoe = union {
  1077.         
  1078.                 difference {
  1079.  
  1080.                 union {
  1081.  
  1082.                         cylinder { < 0, 0, 0 > < 0, -4, 0 >, 3 }
  1083.  
  1084.                         cylinder { < 0, -1, 0 > < 0, -4, 0 >, 2.5
  1085.                                 scale < 1, 1, 2 >
  1086.                                 translate z * -2 }
  1087.  
  1088.                         } // End of union.
  1089.  
  1090.                 // Slice off top at an angle.
  1091.                         box { < -4, -1.5, -12 > < 4, 6, 12 >
  1092.                                 rotate x * -10 }
  1093.  
  1094.                 } // End of difference.
  1095.  
  1096.                 // Add laces.
  1097.                 box { <-1,-1.5,-2><1,-1.3,-6> rotate x*-10
  1098.                         pigment { checker Black, White
  1099.                         scale < 10, 10, 0.5 > translate x*3 } }
  1100.  
  1101.                 texture { P4_Shoe_Texture }
  1102.  
  1103.                 translate y * 2
  1104.  
  1105.                 } // End of union.
  1106.  
  1107.         #end
  1108.  
  1109. //------------------------------------------------------------------->
  1110. //------------------------------------------------------------------->
  1111. //
  1112. // Now add some legs.
  1113.  
  1114.         #declare P4_Half_Leg_Length = P4_Leg_Length / 2
  1115.  
  1116.  
  1117.         #declare Left_Shin = union {
  1118.  
  1119.                 sphere { 0, 3 texture{P4_Skin_Texture} }
  1120.  
  1121.                 cone { <0,0,0>,3 <0,(-1*P4_Half_Leg_Length),0>,2
  1122.                 texture{P4_Skin_Texture} }
  1123.  
  1124.                 object { One_Shoe translate y * (-1*P4_Half_Leg_Length) }
  1125.  
  1126.                 rotate P4_Left_Knee_Rotate
  1127.  
  1128.                 } // End of union.
  1129.  
  1130.         #declare Right_Shin = union {
  1131.  
  1132.                 sphere { 0, 3 texture{P4_Skin_Texture} }
  1133.  
  1134.                 cone { <0,0,0>,3 <0,(-1*P4_Half_Leg_Length),0>,2
  1135.                 texture{P4_Skin_Texture} }
  1136.  
  1137.                 object { One_Shoe translate y*(-1*P4_Half_Leg_Length) }
  1138.  
  1139.                 rotate P4_Right_Knee_Rotate
  1140.  
  1141.                 } // End of union.
  1142.  
  1143.         #declare Left_Leg = union {
  1144.  
  1145.                 object{Left_Shin translate y*(-1*P4_Half_Leg_Length)}
  1146.  
  1147.                 cone { <0,0,0>,5 <0,(-1*P4_Half_Leg_Length),0>,3
  1148.                         texture{P4_Skin_Texture}
  1149.                         } // End of cone.
  1150.  
  1151.                 rotate P4_Left_Leg_Rotate
  1152.                 translate x * -3
  1153.  
  1154.                 } // End of union.
  1155.  
  1156.  
  1157.         #declare Right_Leg = union {
  1158.  
  1159.                 object{Right_Shin translate y*(-1*P4_Half_Leg_Length)}
  1160.  
  1161.                 cone { <0,0,0>,5 <0,(-1*P4_Half_Leg_Length),0>,3
  1162.                         texture{P4_Skin_Texture}
  1163.                 } // End of cone.
  1164.  
  1165.                 rotate P4_Right_Leg_Rotate
  1166.                 translate x * 3
  1167.                 } // End of union.
  1168.  
  1169. //------------------------------------------------------------------->
  1170. //------------------------------------------------------------------->
  1171. //
  1172. // Put everything together.
  1173.  
  1174.         #declare One_Person = union {
  1175.  
  1176.                 union {
  1177.                         object { Shirt }
  1178.                         object { Left_Arm }
  1179.                         object { Right_Arm }
  1180.                         object { Entire_Head }
  1181.                         rotate P4_Waist_Rotate
  1182.                         } // End of union.
  1183.  
  1184.                 object { Shorts }
  1185.                 object { Left_Leg  }
  1186.                 object { Right_Leg }
  1187.  
  1188.                 // Enlarge or shrink the entire person!
  1189.  
  1190.                         scale P4_Total_Scale
  1191.  
  1192.                 // Move it all up so the feet are on the floor.
  1193.                 // Test your person with P4_TEST.POV until you
  1194.                 // guess the correct value!
  1195.  
  1196.                         translate y * P4_Y_Adjust
  1197.  
  1198.         } // End of union.
  1199.  
  1200. //------------------------------------------------------------------->
  1201. //------------------------------------------------------------------->
  1202. //
  1203. // End of this file.
  1204.  
  1205.